cmake_minimum_required(VERSION 3.10.2)
project(app)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -fno-rtti -fvisibility=default -D_GNU_SOURCE -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -fPIC -fpic -ffunction-sections -fpermissive -D_GLIBC_MOCK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed -ldl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(MOCK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../mock")
set(KV_STORE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../kv_store")
add_definitions(-DPROCESS_LABEL="mytest")
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/flowctrl_manager appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/uninstaller appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/security appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/session_manager appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/checker appSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/backup_rule appSrc)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/flowctrl_manager)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/uninstaller)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/security)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/session_manager)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/checker)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/account)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/autils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/broadcaster)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/communicator)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/dfx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/log)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/permission)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/security)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../adapter/include/utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/bootstrap/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/config/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/crypto/include)
include_directories(../framework/directory/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/permission/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/rdb)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/kvdb)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/matrix/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/object)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../service/data_share)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../framework/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../../utils_native/base/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../../utils_native/safwk/native/include)
include(${MOCK_DIR}/include/CMakeLists.txt OPTIONAL)
include(${KV_STORE_DIR}/interfaces/CMakeLists.txt OPTIONAL)
set(links secure mock distributeddb adapter kvdb svcFwk service)

add_library(app SHARED ${appSrc})
target_link_libraries(app ${links})
